Skip to content

refactor(nav-drawer): Use native dialog for non-relative nav-drawers#2194

Open
rkaraivanov wants to merge 16 commits into
masterfrom
rkaraivanov/nav-drawer-to-popover
Open

refactor(nav-drawer): Use native dialog for non-relative nav-drawers#2194
rkaraivanov wants to merge 16 commits into
masterfrom
rkaraivanov/nav-drawer-to-popover

Conversation

@rkaraivanov
Copy link
Copy Markdown
Member

Description

  • Use native dialog for non-relative drawers.
  • Expose closing events when a user closes the drawer through interaction.

Type of Change

  • New feature (non-breaking change that adds functionality)
  • Refactoring (code improvements without functional changes)

Related Issues

Closes #2122, #2186, #2187

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors igc-nav-drawer to use the native <dialog> element for non-relative drawers (top-layer rendering) and adds user-interaction close events, aligning with the goal of avoiding z-index/stacking issues and enabling external consumers to react to user-driven closes.

Changes:

  • Switch non-relative nav-drawer rendering/behavior to a native modal <dialog> and add keepOpenOnEscape.
  • Emit igcClosing (cancelable) and igcClosed for user-interaction closes; export the component event map type.
  • Update Storybook and unit tests to cover dialog-based behavior and the new close events.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
stories/nav-drawer.stories.ts Adds Storybook action handlers and a keepOpenOnEscape control; updates drawer item content markup.
src/index.ts Exports IgcNavDrawerComponentEventMap from the package entrypoint.
src/components/nav-drawer/nav-drawer.ts Refactors non-relative mode to native <dialog>, adds close events + keepOpenOnEscape, and adjusts rendering logic.
src/components/nav-drawer/nav-drawer.spec.ts Updates a11y/DOM tests and adds behavior/event coverage for the native dialog implementation.

Comment thread src/components/nav-drawer/nav-drawer.ts
Comment thread src/components/nav-drawer/nav-drawer.ts
Comment thread src/components/nav-drawer/nav-drawer.spec.ts Outdated
Comment thread stories/nav-drawer.stories.ts Outdated
Comment thread stories/nav-drawer.stories.ts Outdated
/**
* Represents a side navigation container that provides
* quick access between views.
* `igc-nav-drawer` is a side navigation container that provides
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid component selector / class names in these doc comments if possible (maybe make that a repo skill note too), since those are picked up by other platforms. The old text was fine:

Suggested change
* `igc-nav-drawer` is a side navigation container that provides
* Represents a side navigation container that provides

Or you can use the 'friendly' name like Navigation/Nav Drawer if you want to explicitly mention the name in the comment.

* @csspart base - The base wrapper of the igc-navigation-drawer.
* @csspart main - The main container of the igc-navigation-drawer.
* @csspart mini - The mini container of the igc-navigation-drawer.
* @csspart base - The base wrapper of the drawer. A `<dialog>` element for non-relative positions, a `<div>` for relative.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it div or is it <nav> now? Also do we really need to go into so much detail? Not sure what styling scenarios the base is supposed to enable, but I'm not sure we should be that explicit about the internal structure (that's obv subject to change)

Comment thread CHANGELOG.md
- Added `keepOpenOnEscape` property — prevents the drawer from closing when the user presses the **Escape** key (non-relative positions only).
- Added `igcClosing` event — emitted just before the drawer is closed by user interaction. Cancelable.
- Added `igcClosed` event — emitted just after the drawer is closed by user interaction.
- The `mini` slot content is now always visible whenever it is provided, regardless of the drawer's position or open state.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um, what? Not sure I'm getting this correctly, but is this changing the behavior of mini now? Besides being unrelated to the PR scope, it also doesn't make sense to me, mini is an alternative closed state.

simeonoff added 3 commits May 18, 2026 12:02
…border directions

- Make border declarations position-aware: inline borders for start/end,
  block borders for top/bottom
- Group each position's rules into self-contained blocks
- Consolidate backdrop lifecycle under &::backdrop / &:open::backdrop
- Scope transition-delay for mini to the relative position context
- Fix [part~='mini'] → [part='mini'] selector inconsistency
- Update shared theme files to align with restructured base styles
…ut :open support

- Add @supports not selector(:open) block providing host attribute-based
  open/close animations for browsers that don't yet support the :open
  pseudo-class (Safari < 26.5)
- Override transition-property in the fallback to exclude overlay and
  display, preventing the closing glitch where the dialog falls to
  document flow and appears at the wrong position in browsers without
  overlay support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request nav-drawer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Navigation Drawer] Use the Popover/Dialog API as a basis for the component

4 participants